package market

import (
	"context"

	"git.900sui.cn/kc/rpcinterface/client"
	"git.900sui.cn/kc/rpcinterface/interface/market"
)

/*
 * @Author: your name
 * @Date: 2021-06-01 15:51:25
 * @LastEditTime: 2021-06-17 17:32:06
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \rpcMarket\rpcinterface\client\market\coupon.go
 */

type Coupon struct {
	client.Baseclient
}

func (m *Coupon) Init() *Coupon {
	m.ServiceName = "rpc_market"
	m.ServicePath = "Coupon"
	return m
}

//添加优惠券
func (n *Coupon) AddCoupon(ctx context.Context, params *market.AddCouponArgs, reply *bool) error {
	return n.Call(ctx, "AddCoupon", params, reply)
}

//编辑优惠券
func (n *Coupon) EditCoupon(ctx context.Context, params *market.EditCouponArgs, reply *bool) error {
	return n.Call(ctx, "EditCoupon", params, reply)
}

//消费优惠券
func (n *Coupon) ConsumeCouponsByUser(ctx context.Context, params *market.ConsumeCouponArgs, reply *bool) error {
	return n.Call(ctx, "ConsumeCouponsByUser", params, reply)
}

//获取优惠券列表
func (n *Coupon) CouponList(ctx context.Context, params *market.CouponListArgs, reply *market.CouponReplyList) error {
	return n.Call(ctx, "CouponList", params, reply)
}

//停止优惠券
func (n *Coupon) StopCoupons(ctx context.Context, params *market.StopCouponArgs, reply *bool) error {
	return n.Call(ctx, "StopCoupons", params, reply)
}

//按用户查找优惠券列表
func (n *Coupon) FindCouponsByUser(ctx context.Context, params *market.FindCouponsByUserArgs, reply *market.FindCouponByUserReplyList) error {
	return n.Call(ctx, "FindCouponsByUser", params, reply)
}

//获取优惠券详情
func (n *Coupon) FindCouponById(ctx context.Context, params *market.GetCouponInfoArgs, reply *market.CouponReply) error {
	return n.Call(ctx, "FindCouponById", params, reply)
}

//用户-根据产品获取优惠券信息及列表
func (n *Coupon) CouponListByConds(ctx context.Context, params *market.GetCouponListByProdId, reply *market.UserCouponReplyList) error {
	return n.Call(ctx, "CouponListByConds", params, reply)
}

//用户-领取优惠券
func (n *Coupon) ReceiveCouponByUser(ctx context.Context, params *market.ReceiveCouponArgs, reply *bool) error {
	return n.Call(ctx, "ReceiveCouponByUser", params, reply)
}

//商户-查找用户已领并可用的优惠券
func (n *Coupon) FindCouponsByUserOfPc(ctx context.Context, params *market.FindCouponsByUserOfPcArgs, reply *market.FindCouponByUserReplyListOfSaas) (err error) {
	return n.Call(ctx, "FindCouponsByUserOfPc", params, reply)
}

//通用-按照couponid获取用户优惠券数据
func (n *Coupon) GetReceivedCouponUserListById(ctx context.Context, args *market.ReceiveCouponUserListByIdArgs, reply *[]market.ReceiveCouponUserListByIdReply) error {
	return n.Call(ctx, "GetReceivedCouponUserListById", args, reply)
}

//用户-根据shopid获取相应的优惠卡券
func (n *Coupon) GetCouponListByShopIdOfApp(ctx context.Context, args *market.GetCouponListByShopIdOfAppArgs, reply *map[int][]market.GetCouponListByShopIdOfAppReply) error {
	return n.Call(ctx, "GetCouponListByShopIdOfApp", args, reply)
}

//内部-获取优惠券详情
func (n *Coupon) FindCouponByIdOfInternal(ctx context.Context, params *market.GetCouponInfoArgs, reply *market.CouponReply) error {
	return n.Call(ctx, "FindCouponByIdOfInternal", params, reply)
}

//用户-订单已领取优惠券列表展示
func(n *Coupon)GetReceivedCouponListOfOrder(ctx context.Context,args *market.GetReceivedCouponListOfOrderArgs,reply *market.GetReceivedCouponListOfOrderReplies)error{
	return n.Call(ctx, "GetReceivedCouponListOfOrder", args, reply)
}

//内部-根据用户领取的主键id获取优惠券id
func(n *Coupon)GetUserCouponInfoById(ctx context.Context,kId *int,reply *int)error{
	return n.Call(ctx, "GetUserCouponInfoById", kId, reply)
}
func(n *Coupon)CancelCoupon(ctx context.Context,kId *int)error{
	return n.Call(ctx, "CancelCoupon", kId, true)
}

//用户-获取用户数量
func(n *Coupon)GetCouponNumByUser(ctx context.Context,uid *int, num *int)error{
	return n.Call(ctx, "GetCouponNumByUser", uid, num)
}